﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace DNF.WCF.Service
{
    class CustomHostFactory : System.ServiceModel.Activation.ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            // If more than one base address exists then return the second address,
            // otherwise return the first address
            if (baseAddresses.Length > 1)
            {
                return new ServiceHost(serviceType, baseAddresses[1]);
            }
            else
            {
                return new ServiceHost(serviceType, baseAddresses[0]);
            }
        }
    }

    class CustomHost : ServiceHost
    {
        public CustomHost(Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        { }
    }
}
